<template>
	<view>
		<view class="center_menu">
			<view class="menu_item">
				<text>用户名：</text>
				<text>{{ userInfo.username}}</text>
			</view>
			<view class="menu_item">
				<text>昵称：</text>
				<text>{{userInfo.nickname}}</text>
			</view>
			<view class="menu_item">
				<text>头像：</text>
				<image v-if="userInfo.avatarUrl" style="width: 50px;height: 50px;" :src="userInfo.avatarUrl"
					mode="scaleToFill">
				</image>
				<image v-else style="width: 50px;height: 50px;" src="../../../static/images/avatar.png"
					mode="scaleToFill">
				</image>
			</view>
			<view class="menu_item">
				<text>邮箱：</text>
				<text>{{userInfo.email}}</text>
			</view>
			<view class="menu_item">
				<text>电话：</text>
				<text>{{userInfo.phone}}</text>
			</view>
			<view class="menu_item">
				<text>地址：</text>
				<text>{{userInfo.address}}</text>
			</view>
			<view class="menu_item">
				<text>注册时间：</text>
				<text>{{userInfo.createTime}}</text>
			</view>
		</view>

		<button @click="toUpdateUserInfo()" style="position: absolute;bottom: 10px;width: 100%;" plain
			type="primary">修改信息</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			toUpdateUserInfo() {
				uni.navigateTo({
					url: '/pages/user/updateUserInfo/updateUserInfo'
				})
			}
		},
		computed: {
			userInfo() {
				let userInfo = {};
				try {
					userInfo = uni.getStorageSync('userInfo');
					console.log(userInfo);
					return userInfo;
				} catch (e) {
					// error
				}
				return userInfo;
			}
		}
	}
</script>

<style>
	@import url('./center.css');

	.menu_item {
		height: 50px;
		margin-bottom: 10px;
	}
</style>
